import Vue from 'vue';
import Router from 'vue-router';

import Home from '@/components/Home'
import Login from '@/views/Login'
import UserInfo from '@/views/base/UserInfo'
import Welcome from '@/views/Welcome'

import E404 from '@/views/404'
import E403 from '@/views/403'

Vue.use(Router);

const routes = [
    {
        name: '默认页面',
        path: '/',
        redirect: '/login'
    },
    {
        name: '首页',
        path: '/',
        component: Home,
        children: [
            {
                path: '/welcome',
                component: Welcome
            },
            {
                path: '/userInfo',
                component: UserInfo
            },
            {
                path: '/404',
                component: E404
            },
            {
                path: '/403',
                component: E403
            }
        ]
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '*',
        redirect: '/404'
    }
];

let router = new Router({
    mode: 'history',
    routes
});

export default router;